package ejb.manager;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import ejb.dao.CityDAO;
import ejb.entity.City;

@Stateless
public class DefaultOldCities implements OldCities {

		@EJB
		private CityDAO citydao;

		private boolean update = false;

		private List<City> cities;

		public DefaultOldCities(){
			update=false;
			this.cities = new ArrayList<City>();
		}

		/* (non-Javadoc)
		 * @see ejb.updater.OldCities#isUpdate()
		 */
		@Override
		public boolean isUpdate() {
			return update;
		}

		/* (non-Javadoc)
		 * @see ejb.updater.OldCities#setUpdate(boolean)
		 */
		@Override
		public void setUpdate(boolean update) {
			this.update = update;
		}

		/* (non-Javadoc)
		 * @see ejb.updater.OldCities#getCities()
		 */
		@Override
		public List<City> getCities() {
			return cities;
		}

		/* (non-Javadoc)
		 * @see ejb.updater.OldCities#setCities(java.util.List)
		 */
		@Override
		public void setCities(List<City> cities) {
			this.cities = cities;
		}
		
		/* (non-Javadoc)
		 * @see ejb.updater.OldCities#copy()
		 */
		@Override
		public void copy(){
			this.cities = citydao.getDetachedCities();			
		}
		
		
}
